<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Projeto Interdiciplinar
 * Gurpo 1 - Primeira turma do curso de Aux Info da Escom Brasília
 * 
 * Description of m_perfil
 *
 *  * @author 2 Sgt Lemoel, 
 *         3 Sgt Albuquerque,
 *         3 Sgt Azambuja,
 *         3 Fabio Moura
 * @since 11/2012
 * @version 1
 */
class M_Perfil extends CI_Model {
    
    public function __construct() {
        parent::__construct();
        $this->_tabela = 'PERFIL';
    }

    public function listaPerfil($arrayCol = null, $where = null, $limit = null, $offset = null, $orderby = null) {
        return $this->select($arrayCol, $where, $limit, $offset, $orderby);        
    }

    public function cmbPerfil($perfilId = null) {        
        /*
         * Buscando a relacao de perfil do banco
         */
        $resultPerfil = $this->listaPerfil()->result();
        $comboPerfil = null;

        /*
         * Montando a combo 
         */
        foreach ($resultPerfil as $value) {
            $selected = ($value->ID == $perfilId) ? "selected='selected'" : '';
            $comboPerfil .= "<option $selected value='$value->ID'>$value->PERFIL_DESC</option>";
        }
        
        return $comboPerfil;
    }

}

?>
